package kr.blogspot.stiner01.moduletutorial;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends ListActivity
{
    String tests[] = {
            "LifeCycleTest",
            "SingleTouchTest",
            "MultiTouchTest",
            "KeyTest",
            "AccelerometerTest",
            "GyroscopeTest",
            "AssetsTest",
            "ExternalStorageTest",
            "SoundPoolTest",
            "MediaPlayerTest",
            "FullScreenTest",
            "RenderViewTest",
            "ShapeTest",
            "BitmapTest",
            "FontTest",
            "SurfaceViewTest" };

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, tests));
    }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id)
    {
        super.onListItemClick(l, v, position, id);
        
        try
        {
            Class cls = Class.forName("kr.blogspot.stiner01.moduletutorial." + tests[position]);
            Intent intent = new Intent(this, cls);
            startActivity(intent);
        }
        catch (ClassNotFoundException e)
        {
            e.printStackTrace();
        }
    }
}
